package com.myjava.collection;

import java.util.ArrayList;
import java.util.Collection;

@SuppressWarnings("FieldMayBeFinal")
class Dog{
   private String name;

    public String getName() {
        return name;
    }
  Dog(String name){
        this.name = name;
  }
}
@SuppressWarnings("ALL")
public class CollectioinDemo2 {
    public static void main(String[] args) {
      Collection cc1= new ArrayList();
      cc1.add("a");
      cc1.add("b");
      cc1.add("c");
      Object[] o1 = cc1.toArray();
        for (int i = 0; i < o1.length; i++) {
            System.out.println(o1[i]);
        }
        System.out.println(o1);
        Collection cc2 = new ArrayList();

        cc2.add(new Dog("井燕河wc"));
        cc2.add(new Dog("wc2"));
        Object[] o2 = cc2.toArray();

        for (int i = 0; i < o2.length; i++) {
            Dog d1 = (Dog) o2[i];
            System.out.println(d1.getName());

        }


    }
}
